home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.amiga.programmer
- Path: mozart.unx.sas.com!jamie
- From: jamie@cdevil.unx.sas.com (James Cooper)
- Subject: Re: Replying to WB Startup message with Sas/C
- Originator: jamie@cdevil.unx.sas.com
- Sender: news@unx.sas.com (Noter of Newsworthy Events)
- Message-ID: <DMtLxL.7oo@unx.sas.com>
- Date: Thu, 15 Feb 1996 14:08:09 GMT
- X-Nntp-Posting-Host: cdevil.unx.sas.com
- References: <717.6614T755T957@codeworks.gen.nz> <388.6614T873T1805@nando.net>
- Organization: SAS Institute Inc.
-
-
- In article <388.6614T873T1805@nando.net>, xyzzy@nando.net (Andy Philpotts) writes:
- >>I'm using Sas/C 6.56, and I'm linking WITHOUT the startup code. I would like
- >>to run my program from the Workbench, so i have to reply to the WBStartup
- >>message. The Sas documentation doesn't tell me how to do this, and the RKM's
- >>just say that the startup code should handel it.
- >
- >Look at "cback.a" in the sc:source directory, I think that may help.
-
- That's fine... if one reads assembler.
-
- However, if you wish to do it in C:
-
- ----------------------------- WBProgSkel.c -----------------------------
- #include <dos/dosextens.h>
- #include <workbench/startup.h>
-
- #include <proto/exec.h>
-
- int mymain(void)
- {
- struct WBStartup *myWBS;
- struct Process *myproc;
-
- myWBS = NULL;
- myproc = (struct Process *)FindTask(NULL);
-
- if (myproc->pr_CLI == NULL)
- {
- myWBS = (struct WBStartup *)GetMsg(myproc->pr_MsgPort);
- }
-
- ... rest of program ...
-
- if (myWBS)
- {
- Forbid();
- ReplyMsg((struct Message *)myWBS);
- }
- return 0;
- }
- ------------------------------------------------------------------------
-
- That's all you need to simply *run* from WB. Now, if you want to check
- for arguments, etc., you also need to check the 'struct WBArg' structure
- in <workbench/startup.h>, and parse things right after the GetMsg() call
- above.
-
- --
- ---------------
- Jim Cooper
- (jamie@unx.sas.com) bix: jcooper
-
- Any opinions expressed herein are mine (Mine, all mine! Ha, ha, ha!),
- and not necessarily those of my employer.
-
- I'm NOT Politically Correct, but that's because I'm "Sensitivity Challenged."
-